<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
<form method="post" action="{:U('Index/co')}">
<input type="hidden" name='dosubmit' value='dosubmit'>
<input type="hidden" name='src' id="src">
<input type="text" name='name' id="name">
<select name='pid'>
	<volist name='list' id='v'>
	<option value="{$v['id']}">{$v['name']}</option>
	</volist>
</select>	
	<a href="javascript:void(0)" onclick="upImage()">上传图片</a>
	<input	type='submit'>
</form>
</body>
<script src="__PUBLIC__/js/jquery.min.js"></script>
<script src="__PUBLIC__/ueditor/ueditor.config.js"></script>
<script src="__PUBLIC__/ueditor/ueditor.all.min.js"></script>
<script type="text/plain" id="j_ueditorupload" style="height:5px;display:none;" ></script>
<script type="text/javascript">
	var o_ueditorupload = UE.getEditor('j_ueditorupload',
      {
        autoHeightEnabled:false
      });
      o_ueditorupload.ready(function ()
      {
     
    o_ueditorupload.hide();//隐藏编辑器
     
    //监听图片上传
    o_ueditorupload.addListener('beforeInsertImage', function (t,arg)
    {
          // alert('这是图片地址：'+arg[0].src);
          // $("#recommend").attr('src',arg[0].src)
          // $("#img").val(arg[0].src)
          //  $("#recommend").show()
          // 
          var str =""
          $.each(arg,function(index,v){

            str +=v.src+','
          })
          $("#name").val(arg[0].alt)
          $("#src").val(str)
    });
     
    /* 文件上传监听
     * 需要在ueditor.all.min.js文件中找到
     * d.execCommand("insertHtml",l)
     * 之后插入d.fireEvent('afterUpfile',b)
     */
        o_ueditorupload.addListener('afterUpfile', function (t, arg)
        {
          alert('这是文件地址：'+arg[0].url);
        });
      });
       
      //弹出图片上传的对话框
      function upImage()
      {
        var myImage = o_ueditorupload.getDialog("insertimage");
        myImage.open();
      }


</script>
</html>